from django.shortcuts import render

# Create your views here.
# news/views.py

from django.shortcuts import render
from .models import NewsArticle, Person  # 导入 Person 模型

def news_list(request):
    articles = NewsArticle.objects.all().order_by('-pub_date')
    return render(request, 'news/news_list.html', {'articles': articles})

def person_list(request):
    persons = Person.objects.all().order_by('name', '-pub_date')
    return render(request, 'news/person_list.html', {'persons': persons})